const express = require('express');
var bodyParser = require('body-parser')

const app = express()
const port = 3000
app.use(express.static('www'))
app.use(bodyParser.json({limit:'100mb'}));

//访问上传文件
app.use('/uploads',express.static('uploads'))

//设置跨域访问
app.all('*', function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");//允许的域名
    res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");//允许的请求方式
    res.header("Access-Control-Allow-Headers","X-Requested-With,token");//允许的head
    res.header("Access-Control-Allow-Headers",'Content-Type,token');//允许的head
    next();
});

 



// //wx
// const wxRuter = require('./wx')
// wxRuter(app)


//admin
const adminRuter = require('./admin')
adminRuter(app)

//hh
// const hhRuter = require('./hh')
// hhRuter(app)

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})
